/*
 * Copyright @ 苏州瑞云信息技术有限公司 All rights reserved.
 */
package cn.com.recloud.bbs.service.impl;

import cn.com.recloud.bbs.dao.SearchArticleDao;
import cn.com.recloud.bbs.entity.bbs_article;
import cn.com.recloud.bbs.service.SearchArticleService;
import cn.com.recloud.bbs.vo.AppListArticVO;
import cn.com.recloud.bbs.vo.CampaignAppVO;
import cn.com.recloud.one.spring.service.impl.BaseServiceImpl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wayne Wang
 * @date 2020-6-24
 */
@Service
public class SearchArticleServiceImpl extends BaseServiceImpl<SearchArticleDao, bbs_article> implements SearchArticleService {
    @Autowired
    SearchArticleDao searchArticleDao;

    @Override
    public List<bbs_article> findTopTen() {
        return searchArticleDao.findTopTen();
    }

    @Override
    public List<AppListArticVO> findAllArticle(String name, Integer pageIndex, Integer pageSize) {
        if(pageIndex <= 0){
            return null;
        }
        Page<AppListArticVO> page = new Page<>(pageIndex, pageSize);
        return searchArticleDao.findAllArticle(page,name);
    }
}
